﻿using Himp.DataHub;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.DependencyInjection;

namespace Himp.Platform
{
    public class DeptsQuery : ISingletonDependency
    {
        private readonly IServiceProvider _serviceProvider;

        public DeptsQuery(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<DeptInfoDto>> GetDeptListAsync(DeptInfoInput input)
        {
            var deptInfoService = _serviceProvider.GetService<IDeptInfoService>();

            return await deptInfoService.GetListAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<DeptInfoDto> GetDeptAsync(Guid id)
        {
            var deptInfoService = _serviceProvider.GetService<IDeptInfoService>();

            return await deptInfoService.GetAsync(id);
        }
    }
}
